package com.hyfrogx.modules.operation.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @author liubin
 */
@TableName("hy_app_push")
@Data
public class HyAppPushEntity implements Serializable{
    /**
	 * 
	 */
	private static final long serialVersionUID = 1888727688330589866L;

	@TableId
	private Integer id;

    /**
     * 推送方式，显示还是APP自解析
     */
    private Integer displayType;

    /**
     * 通知标题
     */
    @NotBlank(message="推送标题不能为空")
    @Length(max=100,message="标题最多255个字")
    private String title;

    /**
     * 通知文字描述 
     */
    @NotBlank(message="通知文字描述不能为空")
    @Length(max=100,message="通知文字最多255个字")
    private String text;

    /**
     * 通知栏提示文字,备注
     */
    @Length(max=100,message="通知栏最多255个字")
    private String ticker;
    
    /**
     * 点击"通知"的后续行为，默认为打开app,关联app_push_config的configType=1的config_id
     */
    @NotNull(message="点击通知后续行为不能为空")
    private Integer afterOpen;


    /**
     *推送模块id,关联app_push_config的configType=2的config_id
     */
    private Integer customAfterOpen;

    /**
    * 资源id
    * */
    private Integer sid;
    
    /**
     * 资源名称。
     *  
     */
    private String nameUrl;
    
    /**
     * 推送方式，0即时，1定时
     */
    @NotNull(message="推送方式不能为空")
    @Max(value=1,message="参数错误")
    @Min(value=0,message="参数错误")
    private Integer type;

    /**
     * 发送时间
     */
    private Date startTime;


    /**
     * 定时发送时间
     */
    @TableField(exist = false)
    private String taskStartDate;

    /**
     * 推送范围，0全部，1个体
     */
    @NotNull(message="推送范围不能为空")
    private Integer displayRange;

    /**
     * 推送渠道：ios/andriod
     * all = 0;
     * ios = 1;
     * android = 2;
     * system = 3;
     * gaiwang =4;
     */
    @NotNull(message="推送渠道不能为空")
    private Integer displayChannel;

    /**
     * 取消任务的时间
     */
    private Date cancleTime;

    /**
     * 推送的状态:-1失败0已提交1发送中2发送完成3发送失败4消息撤回5消息过期7定时任务
     */
    private Integer displayStatus;

    /**
     * 任务ID
     */
    private String taskId;
    
    /**
     * 个体推送的用户的UID
     */
    private Long displayUid;

    /**
     * 操作人的UID
     */
    private Long uid;
    
    /**
     * 创建时间
     */
    private Date createDate;

    /**
     *消息类型,关联app_push_config的configType=3的config_id
     */
    private Integer appMessageType;

    /**
     * 用户名
     */
    @TableField(exist = false)
    private String phone;

    /**
     * 图标
     */
    @TableField(exist = false)
    private String icon;


    /**
     * 操作人
     */
    @TableField(exist = false)
    private String username;

    /**
     * 消息图标
     */
    @TableField(exist = false)
    private String appMessageIcon;

    /**
     * 资源模块
     */
    @TableField(exist = false)
    private String module;

    /**
     * 资源模块
     */
    @TableField(exist = false)
    private String appMessage;

    /**
     * 备注
     */
    @TableField(exist = false)
    private String configRemark;

    @Override
    public String toString() {
        return "HyAppPushEntity{" +
                "id=" + id +
                ", displayType=" + displayType +
                ", title='" + title + '\'' +
                ", text='" + text + '\'' +
                ", ticker='" + ticker + '\'' +
                ", afterOpen=" + afterOpen +
                ", customAfterOpen=" + customAfterOpen +
                ", sid=" + sid +
                ", nameUrl='" + nameUrl + '\'' +
                ", type=" + type +
                ", startTime=" + startTime +
                ", taskStartDate='" + taskStartDate + '\'' +
                ", displayRange=" + displayRange +
                ", displayChannel=" + displayChannel +
                ", cancleTime=" + cancleTime +
                ", displayStatus=" + displayStatus +
                ", taskId='" + taskId + '\'' +
                ", displayUid=" + displayUid +
                ", uid=" + uid +
                ", createDate=" + createDate +
                ", appMessageType=" + appMessageType +
                ", phone='" + phone + '\'' +
                ", icon='" + icon + '\'' +
                ", username='" + username + '\'' +
                ", appMessageIcon='" + appMessageIcon + '\'' +
                ", configRemark='" + configRemark + '\'' +
                '}';
    }
}